import Vue from 'vue';
import VueRouter from 'vue-router';

import Layout from '../views/layout/Layout.vue';

import dashboard from '@/views/dashboard/default/index';
import User from '@/views/user/User.vue';
import Menu from '@/views/menu/Menu.vue';

import components from '@/views/components/index.vue';
import countTo from '@/views/components/countTo.vue';
import drop from '@/views/components/dragist.vue';

import charts from '@/views/charts/index.vue';
import line from '@/views/charts/line.vue';

Vue.use(VueRouter);

// 路由配置表
export const routes = [
    {
        path: '/',
        component: Layout,
        redirect: '/dashboard',
        children: [
            { path: 'dashboard', component: dashboard, name: '控制台' },
            { path: 'menu', component: Menu, name: '菜单管理' }
        ]
    },
    {
        path: '/user',
        component: Layout,
        redirect: '/user/index',
        children: [
            { path: 'index', component: User, name: '用户管理' }
        ]
    },
    {
        path: '/components',
        component: Layout,
        redirect: '/components/index',
        children: [
            { path: 'index', component: components, name: '组件' },
            { path: 'drop', component: drop, name: '组件-countTo' },
            { path: 'countTo', component: countTo, name: '组件-dragist' }
        ]
    },
    {
        path: '/charts',
        component: Layout,
        redirect: '/charts/index',
        children: [
            { path: 'index', component: charts, name: '图表' },
            { path: 'line', component: line, name: '图表-line' }
        ]
    }
];

// 导出路由
export default new VueRouter({
    routes
});